package edu.rit.drh4818.fire.data;

import java.util.Random;

import edu.rit.drh4818.volume.Volume;



/**
 *
 * Random cube of data.
 * 
 * @author Darren Headrick
 *
 */
public class RandomData extends Volume
{
	public static String NAME = "Random";
	private static final int DIMENSION = 70;
	private static final int PADDING = 5;
	private static float factor = 1.2F;
	
	
	public RandomData()
	{
		super( DIMENSION, true, NAME );
	}
	
	/*
	 * (non-Javadoc)
	 * @see edu.rit.drh4818.volume.renderer.VolData#update()
	 */
	public void update() 
	{
		if( volData == null ) return;
		
		Random r = new Random();

		for( int x = PADDING ; x < volData.length-PADDING; x++)
		{
			for( int y =0 ; y < volData[x].length-PADDING; y++)
			{
    			for( int z = PADDING ; z < volData[x][y].length - PADDING; z++)
    			{
    				
    				if( (r.nextInt( DIMENSION ) / factor)  > y )
    				{
    					volData[x][y][z] = (short)(y * 5);
    					if( volData[x][y][z] > 255 )
    						volData[x][y][z] = 255;
    				}
    				else
    				{
    					volData[x][y][z] = 0;
    				}
    			}
			}
		}

		generateTexture();
	}
}
